﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.传输对象模式
{
    public class TransferObjectPatternDemo
    {
        public static void Test()
        {
            StudentBO studentBusinessObject = new StudentBO();

            //输出所有的学生
            foreach (StudentVO student in studentBusinessObject.GetAllStudents())
            {
                Console.WriteLine("Student: [RollNo : "
                + student.RollNo + ", Name : " + student.Name + " ]");
            }

            //更新学生
            StudentVO student1 = studentBusinessObject.GetAllStudents().Find(item => item.RollNo == 0);
            student1.Name = ("Michael");
            studentBusinessObject.UpdateStudent(student1);

            //获取学生
            studentBusinessObject.GetStudent(0);
            Console.WriteLine("Student: [RollNo : "
            + student1.RollNo + ", Name : " + student1.Name + " ]");
        }
    }
}
